/**
 * File ApplicationContextProvider.java created by Pablo Díaz Fernández
 * on 30/04/2012 for the project supply-chain-simulator
 */
package org.lsk.pfc.scsim.model.util;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * Initializes the spring application context and provides its beans.
 * 
 * @author Pablo Díaz Fernández
 */
public final class ApplicationContextProvider {

	/**
	 * Instance of the class.
	 */
	private static ApplicationContext context;

	/**
	 * Private constructor to avoid instantiation.
	 */
	private ApplicationContextProvider() {
	}

	/**
	 * Gets the context.
	 * 
	 * @return the context
	 */
	public static ApplicationContext getContext() {
		if (context == null) {
			context = new ClassPathXmlApplicationContext(
			        new String[] { "/spring-beans/*-beans.xml" });
		}
		return context;
	}
}
